<template>
  <!-- 子任务 -->
  <div class="taskchild">
    <div class="tableed bigTableStyle">
      <el-table
      border
        :data="tableData"
        height="100%"
        :row-class-name="tableRowClassName"
        style="width: 100%;height:100%;"
        @selection-change="handleSelectionChange"
      >
        <!-- <el-table-column type="selection"></el-table-column> -->
        <el-table-column type="index" label="序号" width="80"></el-table-column>
        <el-table-column prop="RWMC" label="子任务名称" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="JQRID" label="机器人编号"></el-table-column>
        <el-table-column prop="ZXSK" label="执行时刻"></el-table-column>
        <el-table-column prop="ZXRQ" label="执行日期"></el-table-column>
        <el-table-column prop="RWZT" label="任务状态"></el-table-column>
      </el-table>
    </div>
    <div class="task-newAddm-btn">
      <el-button type="primary" @click="next" class="centerbox">确认</el-button>
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";

@Component
export default class taskchild extends Vue {
  @Prop() datas!: any[];
  //表格相关
  public tableData = [
    // {
    //   date: "1",
    //   name: "xxxxxxxxx",
    //   address: "xxxxxxxxxxx",
    // },
  ];
  public SelectTable = [];
  public handleSelectionChange(val: []) {
    this.SelectTable = val;
  }
  public tableRowClassName({ row, rowIndex }: any): string {
    // console.log(row, rowIndex);
    if (rowIndex % 2 === 0) {
      return "row1";
    } else {
      return "row2";
    }
  }

  // 子任务列表
  public gettabledata() {
    var params = {
      bdzid: this.datas[0].BDZID,
      czzt: "zrw",
      xjlx: this.datas[0].XJLX,
      rwid:this.datas[0].ID
    };
    (this as any).$services
      .getBdzrw({ data: params, method: "delete" })
      .then((result: any) => {
        if (result.data) {
          this.tableData = result.data;
        }
      })
      .catch((err: object) => {
        console.log(err);
      });
  }

  next() {
    this.$emit("close");
  }
  mounted() {
    this.gettabledata();
  }
}
</script>

<style lang="scss" scoped>
.taskchild {
  width: 100%;
  height: 500px;
  padding: 0.24rem 0;
  .tableed {
    width: 100%;
    height: 400px;
  }
  .task-newAddm-btn {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }
}
</style>

